<template>
	<div class="app">
		<Hello/>
		<h1>
			测试v-text指令:<span v-text="n"/>
		</h1>
		<h1>
			测试v-big指令:<span v-very-big="n"/>
		</h1>
	</div>
</template>

<script>
	import Hello from './components/Hello.vue'
	export default {
		name:'App',
		components:{Hello},
		data() {
			return {
				n:1
			}
		},
		//定义局部指令
		directives:{
			//big函数何时会被调用？—— 当有人使用v-big指令时
			'very-big'(element,{value}){
				// console.log('big')
				element.style.backgroundColor = 'red'
				element.style.color = 'yellow'
				element.innerText = value * 10
			}
		}
	}	
</script>

<style>
	.app{
		background-color: gray;
		padding: 20px;
	}
</style>
